package com.zut.controller;

import com.zut.domain.EnvData;
import com.zut.service.EnvDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/EnvData")
public class EnvDataController {

    @Autowired
    private EnvDataService envDataService;

    @GetMapping("/getEnvData/{startTimestamp}/{endTimestamp}/{token}")
    public List<EnvData> getEnvData(@PathVariable("startTimestamp") String startTimestamp, @PathVariable("endTimestamp") String endTimestamp, @PathVariable("token") String token) {
        System.out.printf("startTimestamp: %s, endTimestamp: %s, token: %s\n", startTimestamp, endTimestamp, token);
        return envDataService.selectByTimestampIntervalAndToken(startTimestamp, endTimestamp, token);
    }


}
